<!-- 提现管理 -->
<script lang="ts">
export default {
  name: "yyWithdrawalManagement",
};
</script>
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">
      提现管理 
    </p>
    <div>
      <dxtable :headBtn="headBtn" :dataJson="dataJson" :portUrl="portUrl" :qx="qx" :czFun="czFun"
        sonRouter="bjyyWithdrawalManagement" ref="databale">
      </dxtable>
    </div>

  </div>
  <n-modal v-model:show="showModal" preset="card" class="Stock-diagnosis">
    <template #header>
      <div>提现审核</div>
    </template>
    <div>
      <n-form ref="formRef" label-width="120" :inline="false" size="normal" label-placement="left"
        class="mt20 sdfsdtrrter">
        <n-form-item label="状态:">
          <div class="fsdfstrtt">
            <n-radio-group v-model:value="jjnmxd" name="radiogroup">
              <n-space>
                <n-radio value="1">
                  审核中
                </n-radio>
                <n-radio value="2">
                  已付款
                </n-radio>
                <n-radio value="3">
                  不通过
                </n-radio>
              </n-space>
            </n-radio-group>
          </div>
        </n-form-item>
        <n-form-item label="不通过原因:" class="mt10" v-if="jjnmxd == 3">
          <n-input rows="6" v-model:value="yujmmnx" type="textarea" placeholder="请输入不通过原因" size="medium"
            clearable></n-input>

        </n-form-item>
      </n-form>

    </div>
    <template #action>
      <div class="tr">
        <n-button @click="showModal = false"> 取消 </n-button>
        <n-button type="primary" class="ml20" @click="qudsdfsdre"> 确认 </n-button>

      </div>
    </template>
  </n-modal>
</template>
<script lang='ts' setup>
import { rowDark } from "naive-ui/es/legacy-grid/styles";
import dxtable from "../../components/util/dxtable.vue";
import { dxget, dxpost, qurl, hf, transferTimeYMDHm, dialog } from "../../util/index";
import { h, ref, reactive, onBeforeUpdate } from "vue";
import { NButton,NImage } from "naive-ui"
const props = defineProps({
  pup: { type: String },
});
const showModal = ref(false)
const jjnmxd = ref('1')
const yujmmnx = ref()
const videourl = ref()
let headBtn = [];
const zdList = ref()
const databale = ref();
const typeli = ref([])
const jmdfs = ref([{ label: "22" }])
const rowsd = ref()
const lkser = ref([])
const formsd = ref({
  title: "",
  url: "",
  cover: "",
  sort: "",
  type:2
})

const initeer = () => {
  databale.value.initDataExpose();
};
const emit = defineEmits(["callBack"]);
// 弹窗公用该列表
let dataJson = reactive([
  {
    title: "id",
    key: "id",
    width: 50,
  },
  {
    title: "姓名",
    key: "Name"
  },
  {
    title: "身份证号码",
    key: "IdCard"
  },
  {
    title: "提现金额",
    key: "money"
  },
  

  {
    title: "提现状态",
    render(row) {
      if (row.state == 1) {
        return "申请中"
      }
  
      if (row.state == 2) {
        return h('span', { class: "ls" }, "已付款")
      }
      if (row.state == 3) {
        return h('span', { class: "red" }, "申请不通过(" + row.msg + ")")
      }
    },
  },


  {
    title: "提现码",
    render(row) {
        return h(NImage,{src:row.moneyReceivingQRCode,class:"dfsdrtwr"})
    },
  },



  {
    title: "添加时间",
    key: "addTime",
    width: "140",
    type: "daterange",
  },
]);
let portUrl = "yuyue/withdrawDeposit?field=withdrawDeposit.msg,withdrawDeposit.addTime,withdrawDeposit.moneyReceivingQRCode,withdrawDeposit.id,withdrawDeposit.money,withdrawDeposit.state,b.nickname,b.Name,b.IdCard";
const qx = {
  DeletePermissionID: "yyWithdrawalManagementdel", //删除
  EditPermissionIdentifier: "yyWithdrawalManagementbj22", // 编辑
  NewPermissionIdentifier: "yyWithdrawalManagementxz", // 新建
  ViewPermissionID: "yyWithdrawalManagementck", // 查看
};



const czFun = {
  fun: (row, loading) => {
  
      return [
        h(
          NButton,
          {
            type: "info",
            quaternary: true,
            onClick: async (e) => {
              showModal.value = true
              rowsd.value = row
              jjnmxd.value = row.audit
              yujmmnx.value = row.content
            },
          },
          "审核"
        )

      ];
 

  },
};
const qudsdfsdre = async () => {

  let ojsde = {
    id: rowsd.value.id,
    audit: jjnmxd.value,
    content: ''
  }
  if (jjnmxd.value == '2') {
    const jnxr = await dialog('确认已付款嘛？通过后将不能修改')
    if (jnxr != 1) {
      return
    }
  }
  if (jjnmxd.value == '3') {
    ojsde.content = yujmmnx.value
    if (!yujmmnx.value) {
      window.$message.success("请输入不通过的原因")
      return
    }
  }
  await dxpost("yuyue/withdrawDeposit", {
    id:ojsde.id,
    state:ojsde.audit,
    msg:ojsde.content
  }, "put")
  showModal.value = false
  initeer()
}



</script>
<style scoped>
.fsdfstrtt {
  position: relative;
  top: 8px;
}
</style>
  
  